//click_list_players.sqf
#include "ACV_Constantes.h"
#include "ACV_ID_main_dlg.h"
private ["_arr","_control","_index","_display","_map","_odpos","_name","_pos","_player"];
disableSerialization;
_arr = _this select 0;
_control = _arr select 0;
_index   = _arr select 1;
_display = findDisplay ACV_DLG_ID_Main_Dlg;
_map =  _display displayCtrl ACV_DLG_ID_Main_Map;
_oldpos = getMarkerPos ACV_MARKER_LOC_Unit;
_name = _control lbText _index;
call ACV_FNCT_ClearAll_WpMarkers;
_player = [_name] call R3F_FNCT_WhoIs;
if (isnil "_player" || { isnull _player } || {!(isPlayer _player)}) exitWith {};
_pos = getpos _player;
if (isnil("ACV_MARKER_LOC_Unit")) then {
	ACV_MARKER_LOC_Unit = createMarkerLocal [_name,_pos] ;
};
ACV_MARKER_LOC_Unit setMarkerShapeLocal "ICON";
ACV_MARKER_LOC_Unit setMarkerTypeLocal "waypoint";
ACV_MARKER_LOC_Unit setMarkerPosLocal _pos;
ACV_MARKER_LOC_Unit setMarkerSizeLocal [0.5,0.5];
ACV_MARKER_LOC_Unit setMarkerTextLocal (format [" %1",_name]);
ACV_MARKER_LOC_Unit setMarkerColorLocal ([_player] call R3F_FNCT_GetMarkerColor);
ACV_MARKER_LOC_Unit setMarkerAlphaLocal 0.5;
if (ACV_Move_Map_Auto) then {
	if ((_pos distance [0,0,0]) > 10) then {
		if (((_oldpos distance _pos) > 500) && (!ACV_Filling_Dlg)) then {
			_map ctrlmapanimadd [0.5,1,_pos];
	   		_map ctrlmapanimadd [0.5,0.06,_pos];
	   		ctrlmapanimcommit _map;
		};
	};
};